type FilterTreeData = {
  id: number,
  name: string,
  children: any[],
  items: any[],
  realPrice?: string | number,
  leaf?: boolean,
  unit?: string,
}

export const filterTree = (arr: FilterTreeData[]) => {
  arr.forEach(item => {
    if(!item.children.length) {
      let itemList = <any[]>[]
      item.items.forEach(j => {
        itemList.push({
          name: `${j.showName},${j.realPrice}元`,
          // name: `${j.showName}`,
          realPrice: j.realPrice,
          id: j.id,
          leaf: true,
          unit: j.unit,

        })
      })
      item.children = itemList
    } else {
      filterTree(item.children)
    }
  })
}